/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import javax.persistence.*;
//import javax.validation.constraints.NotNull;
//import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author The Lunatics
 */
@Entity
@Table(name = "logins")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Logins.findAll", query = "SELECT l FROM Logins l"),
    @NamedQuery(name = "Logins.findByIdLogins", query = "SELECT l FROM Logins l WHERE l.idLogins = :idLogins"),
    @NamedQuery(name = "Logins.findById", query = "SELECT l FROM Logins l WHERE l.id = :id"),
    @NamedQuery(name = "Logins.findByPw", query = "SELECT l FROM Logins l WHERE l.pw = :pw")})
public class Logins implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    //@NotNull
    @Column(name = "idLogins")
    private Integer idLogins;
    @Basic(optional = false)
    //@NotNull
    //@Size(min = 1, max = 45)
    @Column(name = "id")
    private String id;
    @Basic(optional = false)
    //@NotNull
    //@Size(min = 1, max = 45)
    @Column(name = "pw")
    private String pw;
    @JoinColumn(name = "user_id", referencedColumnName = "User_Id")
    @ManyToOne(optional = false)
    private Users userId;

    public Logins() {
    }

    public Logins(Integer idLogins) {
        this.idLogins = idLogins;
    }

    public Logins(Integer idLogins, String id, String pw) {
        this.idLogins = idLogins;
        this.id = id;
        this.pw = pw;
    }

    public Integer getIdLogins() {
        return idLogins;
    }

    public void setIdLogins(Integer idLogins) {
        this.idLogins = idLogins;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getPw() {
        return pw;
    }

    public void setPw(String pw) {
        this.pw = pw;
    }

    public Users getUserId() {
        return userId;
    }

    public void setUserId(Users userId) {
        this.userId = userId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idLogins != null ? idLogins.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Logins)) {
            return false;
        }
        Logins other = (Logins) object;
        if ((this.idLogins == null && other.idLogins != null) || (this.idLogins != null && !this.idLogins.equals(other.idLogins))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Logins[ idLogins=" + idLogins + " ]";
    }
    
}
